package com.mxpio.erp.common.quality.entity;

import com.mxpio.erp.common.inventory.entity.Warehouse;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.math.BigDecimal;

/**
 * @Author : wpp
 * @Datetime : 2023/6/6 14:32
 * @Desc :
 * @Modor :  Modifytime:
 * @modDesc : 不良品处理单 明细
 */
@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_QUALITY_UD_LINE")
@Schema(description="不良品处理单明细")
public class UnqualifiedDisposalLine extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @Id
    @Column(name = "ID_", updatable = false)
    @Generator
    @Schema(description = "流水号")
    private String id;

    @Column(name = "LINE_NO_", updatable = false)
    @Schema(description = "行号")
    private String lineNo;

    @Column(name = "BIZ_NO_", updatable = false)
    @Schema(description = "处理单单号")
    private String bizNo;


    @Column(name = "INSPECTION_BILL_NO")
    @Schema(description = "质检单单号")
    private String inspectionBillNo;

    @Transient
    @Schema(description = "关联的质检单对象，页面质检单相关字段可从该对象中取")
    private InspectionBill inspectionBill;

    //关联的原不合格批相关信息，不良品处理单，明细新增选择的原不合格批次 -begin
    @Column(name = "WH_CODE_")
    @Schema(description = "仓库编号（不良品批次）")
    @Dict(dicCode = "whCode" ,dicEntity = Warehouse.class, dicText = "whName")
    private String whCode;

    @Column(name = "LOT_NO_")
    @Schema(description = "批次号")
    private String lotNo;

    @Column(name = "SUB_LOT_INDEX_")
    @Schema(description = "批次索引号")
    private String subLotIndex;
    //关联的原不合格批相关信息 -end

    //根据不同使用决策，拆批后的信息-begin
    @Column(name = "NEW_WH_CODE_")
    @Schema(description = "拆批后的新批次索引对应仓单")
    @Dict(dicCode = "whCode" ,dicEntity = Warehouse.class, dicText = "whName")
    private String splitNewWhCode;

    @Column(name = "NEW_LOT_NO_")
    @Schema(description = "拆批后的新批次号")
    private String splitNewLotNo;

    @Column(name = "NEW_SUB_LOT_INDEX_")
    @Schema(description = "拆批后的新批次索引号")
    private String splitNewSubLotIndex;
    //根据不同使用决策，拆批后的信息-end

    @Column(name = "LOT_QUANTITY_")
    @Schema(description = "待拆批次原数量")
    private BigDecimal lotQuantity;

    @Column(name = "APPLY_QUANTITY_")
    @Schema(description = "申请数量")
    private BigDecimal applyQuantity;


    @Column(name = "APPLY_DECISION_")
    @Schema(description = "申请使用决策")
    @Dict(dicCode = "ERP_QUAL_SUBLOT_USAGE_DECISION")
    private String applyDecision;

}
